Homomorphic factorization encryption

ABSTRACT

Systems, methods, and computer-executable instructions for secure data analysis using encrypted data. An encryption key and a decryption key are created. The security of encryption using the encryption key and the decryption key are based upon factoring. A computation key is created based upon the encryption key. Data is encrypted using the encryption key. The encrypted data and the computation key are provided to a remote system. The remote system is requested to perform data analysis on the encrypted data. An encrypted result of the data analysis is received from the remote system. The encrypted result of the data analysis is decrypted with the decryption key.

BACKGROUND

Cloud computing has become a preferred computing platform for numerous businesses. Cloud computing alleviates the need for maintaining a business' own data center while still ensuring anytime availability and enough computational power for data analysis. Data analysis has become a key component of most companies' decision making process. Data analysis allows the company to leverage its consumer's data to provide better and cost effective services and gain competitive advantages.

However, a business cannot have security control over cloud computing resources and hence is significantly more vulnerable to attacks on its sensitive data. This might pose disadvantages that nullify the business' competitive advantages of using cloud computing.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a flow diagram of processing encrypted data at a server system in accordance with respective examples.

FIG. 2 is a flow diagram of a process flow of homomorphic encryption in accordance with respective examples.

FIG. 3 is a flow diagram of processing encrypted data at a server system in accordance with respective examples.

FIG. 4 is an example computing device that can be used in conjunction with the technologies described herein.

DETAILED DESCRIPTION

In accordance with techniques described herein, machining learning algorithms may run on encrypted data. Intermediate results may be passed back to a client system. The client system may process the intermediate results, in either encrypted or decrypted form, and provide a machine learning model back to the server system. The server system may then complete the machine learning task and provide the results to the client system. Importantly, the server system does not decrypt the data. Rather, the machine learning is done over the encrypted data. The client's data, therefore, is never exposed on the server system in an unencrypted form.

In accordance with techniques described herein, a client may control the security of its own data via encryption while allowing a remote system to provide results of data analysis that uses the encrypted data. For example, company A has data from its customers which is critical for the company both from legal point of view as well as competitive advantage point of view. Company A, therefore, wants to protect the data but at the same it wants to do some data analysis on its customers' data. For this task, company A wants to use cloud services of company B, so that it doesn't have to build a large datacenter itself.

Company A, however, might be worried that company B or some malicious third party might access its customers' data, which may create, among other issues, legal problems for company A. To avoid this, company A may want to encrypt its consumer data and upload the encrypted data to the cloud hosted by company B. Using public-private key encryption, however, will not allow company A to control the security of its data since company B would need to decrypt the data to complete the requested data analysis.

Described in detail below is an encryption scheme that can encrypt data using a private key while still allowing basic arithmetic operations to be performed on the data using only the encrypted data and a public computation key. The public computation key, however, cannot decrypt the encrypted data.

In an example, a client which owns the data wants to use a server (which might be compromised) to perform arithmetic operations on the data while keeping the data secure. A server (or a cloud provider) receives encrypted data and performs arithmetic operations on it. The server is assumed to perform the required operations correctly. However, even if server does not perform the required operations correctly, it will not compromise the input data.

The described encryption scheme uses an encryption key, a decryption key and a computation key. These keys are all generated by the client (for example company A in the above scenario). The client keeps the encryption key and the decryption key private and not with available to any third entity. The computation key may be publicly available. For example, the computation key may be sent to the server or cloud service provider, e.g., company B.

As an example, the client (company A) encrypts its data using the encryption key and sends the encrypted data to the server (hosted by company B) while ensuring that the original data is kept secure on its own premises. Company A may decide to destroy the original data. Company A may also send the computation key to company B. Company B may use the computation key to perform addition, multiplication or division operations over the encrypted data and sends the results of these operations back to company A. Company A may then use the decryption key to decrypt the final solution.

In accordance with techniques described herein, a novel encryption scheme is described that allows arithmetic operations to be performed efficiently. The encryption scheme is strictly harder than solving factorization. This implies the safety of the data based on accepted standards of risk. A server-client communication framework is described that is based on the realization that although the data size may be large, e.g., multiple petabytes, the model sizes are usually much smaller, e.g., by an order of magnitude or more compared to the data size. Machine learning algorithms are described that operate on the encrypted data. These machine learning algorithms may solve least squares problems and/or a system of linear equations. Further, many supervised machine learning problems may be solved by solving a series of least squares problems.

FIG. 1 is a flow diagram of processing encrypted data at a server system 120 in accordance with respective examples. A client system 110 has various stores of data. The client may want to run machine learning algorithms on this data, and would like to use the server system 120 to run the machine learning algorithms. In an example, the server system 120 is a cloud-based system with a large amount of shared or dedicated computing resources. The client system 110 may encrypt the data. For example, the data may be encrypted using an encryption key. The decrypted data, therefore, would only be available using a decryption key. The client, therefore, may ensure the safety of its own data by limiting access to these keys.

The encrypted data may be sent 130 to the server system 120. The server system 120 may store the data on various storage devices. The server system 120 may perform machine learning on the encrypted data, without decrypting the data. In an example, the server system 120 is unable to decrypt the data as the client system 110 has not and is not required to provide the decryption key needed to decrypt the data. During the training, the server system 120 may transmit intermediate results 132 to the client system 110. For example, intermediate results may be a partially trained model. The client system 110 may run some operations on the encrypted intermediate results or may decrypt the data and run some operations. For example, the intermediate results may include weights of a partially trained model. These weights may be a number with a large numerator and a large denominator. The operations may include rounding the weights to values that can be represented with smaller numerators and denominators. The result of these operations is passed back to the server system 120 in an encrypted form 134. The server system 120 may then complete the modeling 136. In an example, the client system 110 is sent intermediate results multiple times before the modeling is complete. The processing of the intermediate results, however, requires less computing power compared with the modeling that is done on the server system 120.

In an example, the client system 110 may ping the server system 120 to receive a prediction of when new intermediate results, e.g., data points, will be available. In an example, the server system 120 may provide the client system 110 with an indication when new intermediate results will be available without being pinged by the client system 110.

Various parameters such as an amount of communication between client and server, an amount of computation the client should do, security guarantee for the encryption scheme, and accuracy and scalability of machine learning algorithms impact how useful the disclosed system is to clients. Described herein are an encryption scheme and machine learning (ML) training algorithms that consider the above parameters. In an example, the disclosed encryption scheme includes generating three keys: an encryption key, a decryption key, and a computation key. The encryption and decryption key may be private to the client while the computation key is shared with the server system. The computation key, however, is unable to decrypt the encrypted data. In an example, all the keys are random matrices or their inverses. Encryption may be based on multiplying the input with a random matrix over a finite field. Due to the linear structure, performing addition is possible. Multiplication/division of encrypted data may use the computation key.

After the encrypted data is uploaded on the server, the server may try to train various machine learning models. A general class of supervised learning algorithms, which include important problems such as linear regression, logistic regression, sparse regression etc. may be used to train a machine learning model. For a linear regression problem, a standard stochastic gradient descent (SGD) algorithm may be used over the encrypted data using the provided computation key. However, for other problems like logistic regression, standard SGD may require several rounds of communication between client and server. In an example, the problem may be reduced to a series of weighted linear regression which may be solved using the method mentioned above. This scheme reduces the communication between the server system and the client system and leads to a more efficient solution.

As described above, various features described herein use matrices. Matrices may be represented with bold capital alphabets like X and vectors with bold small letters like w. For a matrix X, the ith row of the matrix is referred to as x_(i). X_(ij) is used to represent the element in the ith row and jth column. For a vector w, w_(i) to represent the vector's ith element. The symbols ⋅ and º to represent the dot product and element-wise product of two vectors respectively.

For an entity u, û is used to represent its encrypted version. The notation diag(α) to represent a diagonal matrix with vector α as its diagonal. In addition, V(α) to represent a Vandermonde matrix.

Homomorphic encryption schemes allow for evaluation of any circuit e.g., an arithmetic operation, over the underlying plain data while observing only the encrypted version of the data. Some homomorphic encryption schemes rely on security guarantees that require hardness of certain ring-LWE (learning with errors) problems which is a relatively new assumption that is untested in practice. In contrast, the described encryption scheme as well as the majority of the non-homomorphic cryptography systems are based on hardness of factorization.

Another concern with the existing homomorphic schemes is that they need a certain ‘bootstrapping’ procedure after a certain number of operations. The bootstrapping procedure needs to be applied to the entire dataset rather than the trained model, which may lead to infeasible communication and computation costs in the big-data regime. In contrast, the described encryption scheme allows for an arbitrarily number of additions, multiplications and divisions, as long the numbers being operated upon and the numbers generated in the results fall into a specified range. Moreover, in some examples, the intermediate communication/computation for client operates only on the trained model which is of significantly smaller size than the entire training data. Thus, once a model is trained/learned, the described system may output predictions for infinitely many test points, while the existing homomorphic encryption methods would need to bootstrap after predicting for a fixed number of test points.

In an example, machine learning algorithms are used that are based on iteratively reweighted last squares (IRLS) which reduce the optimization problem to a series of weighted least squares problems. These machine learning algorithms may use the encrypted client data without having to decrypt the data or without requiring bootstrapping.

Suppose the client has a set of points (x₁, y₁) . . . (x_(n), y_(n)) where x_(i)∈R^(d) and the client wants to learn a linear regression function w∈R^(d)s.t.x_(i)·w˜y_(i). This function may be learned by minimizing the least squares loss function Σ_(i)(x_(i)·w−y_(i))² which is at least O(nd) computation. Using a cloud-based system, therefore, may be beneficial to more efficiently solve this problem. In an example, the client may send the encrypted data ({circumflex over (x)}₁,ŷ₁) . . . ({circumflex over (x)}_(n),ŷ_(n)) to a remote system, such as a cloud system. The remote system may run machine learning algorithms and return an encrypted model ŵ to the client system. In addition, the remote system may provide predictions

₁, . . .

_(n) on some new data

₁, . . .

_(n). The client system may provide the new encrypted data and the remote system may provide the encrypted predictions back to the client system.

As described above, as part of the machine learning by the remote system, intermediate results may be provided back to the client system. In an example, the intermediate result may be an encrypted approximation ŵ′ of the model ŵ. The client system receives ŵ′ and sends an encrypted transformed value ŵ″ to the remote system. For moderately sized data sets, a model size is much less than the data used to learn the model. Accordingly, the amount of communication performed in the intermediate steps when compared to the size of the data, on which the complexity of the algorithm depends is relatively small.

In an example, the encryption scheme includes an encryption key, a decryption key and a computation key. All the keys may be generated by the client. The encryption and decryption keys may be private. Thus, a client is able to maintain the security of its own data. The computation key is provided to the server together with the encrypted data.

In an example, the described encryption scheme may work on k instances of an operation at the same time, e.g., for any operation, say addition, it takes in k pairs of numbers and returns the answer to these k additions together. In this example, this means that numbers are always encrypted in k-tuples. Vectors of size k are used to denote this. Note that the k different operations that happen simultaneously do not interact with each other. Hence, k instances of an arithmetic circuit may be evaluated at the same time. These circuits may be referred to as vector circuits. The notation û is used to represent the encryption of a k-dimensional vector u.

The described encryption scheme has various features. The encryption scheme works with rationals, which may be needed by the machine learning algorithms used on the encrypted data. A subset of rationals is encoded to a subset of integers. The integer encodings form the plaintext which gets encrypted. The basic operations of addition, subtraction, multiplication and division of the rationals may be performed directly on the encodings. The division operation is essentially multiplication with the ‘inverse’.

The ciphertext produced is a linear transformation of the plaintext. Hence, for a plaintext u, to compute cu or u/c, where c is a constant, then only cu or u/c respectively needs to be computed. To multiply two sets of k numbers, u and v, a matrix transformation of the vector ûº{circumflex over (v)} may be done.

Thus, the following operations: encryption, decryption, addition, subtraction, multiplication and division by a constant, and multiplication, all involve only matrix vector products and may be implemented efficiently in practice. Division involves solving a system of linear equations and may be slow in comparison to multiplication.

The encryption scheme is now presented formally. A first scheme which has an O(k²) overhead for multiplication of O(k) numbers. The scheme may be extended to work with special classes of keys and reduce the multiplication overhead to O(k) by exploiting algebraic properties of Generalized Reed-Solomon codes. The second scheme may be referred to as the Vandermonde scheme. In both schemes, there is no overhead for addition while for division both the schemes have an overhead of O(k³).

The First Scheme

Linear codes over a ring R=Z/N Z for N a semi-prime are considered. Homomorphic evaluation of arithmetic circuits modulo N are provided. For some k, the homomorphic evaluation of the maps:

+,º,/:R ^(k) ×R _(k) →R ^(k)

such that (u+v)_(i)=u_(i)+v_(i), (uºv)_(i)=u_(i)v_(i) and (u/v)_(i)=uv⁻¹. Abstractly, let A be an automorphism of the module R^(k). Note that + is a linear map on (R^(k))², and that º is a bilinear map on (R^(k))². Hence after application of the automorphism A, these maps are sent to maps +_(A) and º_(A) which are still linear and bilinear respectively. The described scheme may be viewed to provide these maps.

Concretely, a basis is fixed and so the automorphism A may represented by an invertible k×k matrix (A_(ij)). Given vectors u, v the various operations related to the scheme are given by:

Enc_(A)(u)=A ⁻¹ u

Dec_(A)(û)=Au

{circumflex over (u)}+_(A) {circumflex over (v)}={circumflex over (u)}+{circumflex over (v)}

(ûº _(A) {circumflex over (v)})_(i)=Σ_(jk) T _(ijk) û _(j) {circumflex over (v)} _(k) ,T _(ijk)=Σ_(l)(A ⁻¹)_(il) A _(lj) A _(lk)

û/ _(A) {circumflex over (v)}=M ⁻¹ û,M _(ij)=Σ_(k) T _(ijk) {circumflex over (v)} _(k)

The matrix T is essentially a tensor for the bilinear operation in the transformed space A. The encryption key EK may be (A⁻¹, N, k), the decryption key DK is (A, N, k), and the computation key CK is (T, N, k). This encryption scheme is homomorphic with respect to addition, multiplication, and division operations and may be represented as:

Dec_(A)(û+ _(A) {circumflex over (v)})=u+v

Dec_(A)(ûº _(A) {circumflex over (v)})=uºv

Dec_(A)({circumflex over (u)}/_(A) {circumflex over (v)})=u/v

The Vandermonde Scheme

As mentioned earlier, the basic scheme described above incurs an O(k²) overhead for multiplication. A Vandermonde scheme may be used to reduce the overhead to O(k). A plaintext-ciphertext pair may be weighted evaluations of a polynomial ƒ of degree<k. Let α, γ∈Q^(k) and β, δ∈Q^(2k), where Q is an appropriate extension of ring R. Therefore, ƒ may encode the plaintext u if u_(i)=γ_(i) ⁻¹ƒ(β_(i)). The length of a ciphertext is twice that of its plaintext. Given a ciphertext û, the plaintext u may be obtained using the transformation A=V₁πV₂ ⁻¹ where

V ₁=diag(γ⁻¹)V(α)

V ₂=diag(δ⁻¹)V(β)

π=[I _(k)|0_(k)]

The transformation interpolates the function ƒ from the ciphertext, evaluates it on points α and weights these evaluations with weights γ⁻¹ to compute the plaintext. Note that A is a surjective morphism from R^(2k) to R^(k). Hence, A is right-invertible. A⁻¹ may be considered the right inverse V₂π^(T)V₁ ⁻¹ of A.

Now, for plaintexts u and v encoded by polynomials ƒ and g respectively, the plaintext diag(γ)(uºv) is encoded by the polynomial h=ƒ ·g. This follows from:

h(α_(i))=ƒ(α_(i))g(α_(i))=γ_(i) ² u _(i) v _(i)

The ciphertext diag(δ)(ûº{circumflex over (v)}) may also be encoded by h. This follows from:

h(β_(i))=ƒ(β_(i))g(β_(i))=δ_(i) û _(i) {circumflex over (v)} _(i)

Since h=ƒ·g can be of degree≥k. While decrypting the ciphertext that h encodes, a fault plaintext may be retrieved because the decryption map ignores coefficients of powers≥k. The degree of h may be reduced while maintaining its evaluations on α_(i)'s. This can be achieved by reducing h modulo Π_(i)(X−α_(i)). Further details of this reduction follow. A k×2k reducer Red=V₂ ^(T)πRV₂ ⁻¹diag(δ), where the map R is defined as

${\sum\limits_{i}{R_{ij}X^{i}}} = {X^{j}{D(X)}{mod}\; {\prod\limits_{i}{\left( {X - \alpha_{i}} \right).}}}$

With D(α_(i))=γ_(i) ⁻¹. Equivalently:

R=V(α)⁻¹diag(γ)⁻¹ [V(α)|diag(α)^(k) V(α)].

This leads to:

{circumflex over (u)}º_(A) {circumflex over (v)}=Red({circumflex over (u)}º{circumflex over (v)}).

The construction of /_(A) is more complex, as for any fixed v the map w→Red(vºw) is not invertible. Thus, to find ŵ=û/_(A){circumflex over (v)}, a ŵ that is both in the preimage of û under the above map, and in the image of Red is needed. Given Red, a 2k×k matrix B may be found such that im(B)=im(Red), e.g., such that the columns B are a basis for the column space of Red. A k×2k matrix K of rank k may also be found such that ker(K)∩im(Red)={0}, e.g., such that KB is an invertible k×k matrix, which may be done as the row rank of B is k. This also leads to the following:

û=Red({circumflex over (v)}ºŵ)

⇔:û=Red diag({circumflex over (v)})ŵ

⇔Kû=K Red diag({circumflex over (v)})ŵ

⇔Kû=K Red diag({circumflex over (v)})Bw′,ŵ=Bw′

Then M=K Red diag({circumflex over (v)})B is an invertible k×k matrix, and ŵ=BM⁻¹Kû. Thus, the operations of this scheme may be listed as follows:

Enc_(A)(u)=A ⁻¹ u

Dec_(A)({circumflex over (u)})=A{circumflex over (u)}

û+ _(A) {circumflex over (v)}=û+{circumflex over (v)}

({circumflex over (u)}º_(A) {circumflex over (v)})_(i)=Red({circumflex over (u)}º{circumflex over (v)}),Red=V ₂ ^(T) πRV ₂ ⁻¹diag(δ)

{circumflex over (u)}_(A) {circumflex over (v)}=ŵ,ŵ=BM ⁻¹ K{circumflex over (u)},M=K Red diag({circumflex over (v)})B

Thus, given two k-dimensional vectors u, v for the described Vandermonde encryption scheme with decryption key A, the following may be determined:

Dec_(A)({circumflex over (u)}+_(A) {circumflex over (v)})=u+v

Dec_(A)({circumflex over (u)}º_(A) {circumflex over (v)})=uºv

Dec_(A)({circumflex over (u)}/_(A) {circumflex over (v)})=u/v

FIG. 2 is a flow diagram of a process flow 200 of homomorphic encryption in accordance with respective examples. The process flow 200 may be executed on a computing device. The process flow 200 may start at 210 by creating an encryption key. For example, a client system may create the encryption key. At 220, a corresponding decryption key is created. In an example, the decryption key is a matrix. The encryption key may be a right inversion of the decryption key. The security of the encryption scheme that uses the encryption key and the decryption key is based upon factorization. The encryption key and the decryption key may be kept private on the client system. Accordingly, remote systems will not have the key needed to encrypt data or decrypt data using the encryption and decryption keys.

At 230, a computation key is created that is based upon the encryption key. In an example, the computation key is based upon the matrix of the decryption key. At 240, data, such as a vector of numbers, is encrypted using the encryption key to create encrypted data. At 250, the encrypted data and the computation key are provided to a remote system. At 260, the client system requests data analysis be done on the encrypted data. For example, the client system may request that a machine learning algorithm be ran on the encrypted data.

In another example, the client system may want to determine an average value and a variance of values. For example, the values may be salary information. The client may have M employees and i-th employee's salary is given by S_(i). Then, the client forms a vector x_(i) for i-th employee where first coordinate of x_(i) is S_(i) and the remaining k−1 coordinates can be random numbers. Now, client encrypts each x_(i) using the above encryption operation described above which results in a 2k dimensional vector {circumflex over (x)}_(l). The client then sends all the M vectors {circumflex over (x)}_(l), 1≤i≤M to the server along with the computation key B.

The server then computes the average salary as:

$\hat{x} = \frac{\Sigma_{i}}{M}$

and the variance as

$\hat{V} = {\frac{{\Sigma_{i}\left( {{\hat{x}}_{i} - \hat{x}} \right)}_{A}^{o}\left( {{\hat{x}}_{i} - \hat{x}} \right)}{M}.}$

The server sends back {circumflex over (x)} and {circumflex over (V)} to the client. The client may then use the decryption operation to obtain the average salary and variance in the salaries. That is, x=Dec_(A)({circumflex over (x)}) and V=Dec_(A)({circumflex over (V)}).

At 270, the encrypted results of the data analysis that was done on the encrypted data is received from the remote system. In an example, the results are a model created by a machine learning algorithm that the remote system creates. In various examples, to create the model, the remote system may provide the client system with an intermediate model. The client system may decrypt the intermediate model using the decryption key and perform rounding on various weights of the model. Once the weights have been rounded, the updated model may be encrypted with the encryption key and sent back to the remote system for further machine learning. In an example, the encrypted result is the final model that has reached a particular level of precision. At 280, the client system decrypts the encrypted result using the decryption key.

In an example, the encryption scheme may be implemented in software written in any standard programming language like C, C++, Java, etc. using standard big-integer libraries. Another implementation may include building specialized hardware to speed up the most common operations used in the scheme. The encryption/decryption operator may be deployed on the client side, that would first generate the encryption, decryption, computation key and then use big-integer libraries to compute the encryption of the given data. The arithmetic operators may be executed on a remote system. The big-integer libraries may be used to perform various operations needed for computing the computation result on the remote system.

To handle rational numbers, rational numbers may be mapped. For example, let N=pq where p, q are primes and Q is the set of all rationals. Let

${Q_{n} = \left\{ {{\frac{a}{b} \in {Q\text{:}\mspace{14mu} {{GCD}\left( {b,N} \right)}}} = 1} \right\}},$

and define φ: Q_(n)→Z/NZ by:

$\left. \frac{a}{b}\rightarrow{{ab}^{- 1}{mod}\; N} \right.,$

where b⁻¹b=1 mod N. Then φ is injective on

$\left\{ {{\frac{a}{b} \in {Q\text{:}\mspace{14mu} {a}}},{b < \sqrt{\frac{N}{2}}}} \right\},{{{as}\mspace{14mu} {\phi \left( \frac{a_{1}}{b_{1}} \right)}} = {\phi \left( \frac{a_{2}}{b_{2}} \right)}}$

implies that:

a ₁ b ₁ ⁻¹ =a ₂ b ₂ ⁻¹ mod N

a ₁ b ₂ =a ₂ b ₁ mod N

And since

${a_{i}},{b_{i} < \sqrt{\frac{N}{2}}}$

both sides are bounded in modules by

$\frac{N}{2},$

and hence a₁b₂=a₂b₁. The map p may be used as the rational encoding.

The map may be used to retrieve a rational number from its encoding. Given some x∈Z/NZ,

${a},{b < \sqrt{\frac{N}{2}}}$

such that x=ab⁻¹ mod N may be found. First, for some integer

${c < \sqrt{\frac{N}{2}}},$

the following holds:

${{bx} = {\left. {a + {cN}}\Rightarrow\frac{x}{N} \right. = {\frac{c}{b} + \frac{a}{bN}}}},$

and note that

$\frac{a}{bN} < {\left( {b\sqrt{2\; N}} \right)^{- 1}.}$

So, for there to be two such approximations

${\frac{c_{i}}{b_{i}}\mspace{14mu} {to}\mspace{14mu} \frac{x}{N}},$

one has

$\frac{1}{b_{1}b_{2}} \leq {{\frac{c_{1}}{b_{1}} - \frac{c_{2}}{b_{2}}}} < {\left( {\frac{1}{b_{1}} + \frac{1}{b_{2}}} \right)\frac{1}{\sqrt{2\; N}}}$

which implies b₁+b₂>√{square root over (2N)}, a contradiction. Hence, the approximation

$\frac{c}{b}\mspace{14mu} {for}\mspace{14mu} \frac{x}{N}$

is unique for

$b < {\sqrt{\frac{N}{2}}.}$

Accordingly, for any real z, the error of an approximation

$\frac{c}{b}$

for z may be measured by |b₂−c|. In this case,

$z = \frac{x}{N}$

is a rational of denominator N, while

$\frac{c}{b}$

is a rational with denominator

$< {\sqrt{\frac{N}{2}}.}$

As the upper bound for b grows, the least possible error decreases. Then, since

${{{b\frac{x}{N}} - c} = \frac{a}{N}},$

If

$\frac{c}{b}$

is the best rational approximation to

${{\frac{x}{N}\mspace{14mu} {with}\mspace{14mu} b} < \sqrt{\frac{N}{2}}},$

then the derived |a| is minimal, and so if the derived a is bounded in modulus by

$\sqrt{\frac{N}{2}}\mspace{14mu} {then}\mspace{14mu} \frac{a}{b}$

is the desired rational. To recover a, b from x it suffices to find the rational approximation to

$\frac{x}{N}$

with the denominator bounded by

$\sqrt{\frac{N}{2}}$

and least error, a so called “best approximation of the second kind.”

For any real z∈[0,1), a continued fraction for z may be defined as:

cƒ(0)=[0],

cƒ(z)=[└z ⁻¹ ┘]∥cƒ(z ⁻¹ −└z ⁻¹┘) otherwise.

For rationals, the continued fraction is finite, and may be computed in poly-log time. Any rational whose continued fraction is a prefix of cƒ(z) is a convergent of z. The set of best approximations of the second kind to z are the convergents of z based on a classical theorem.

Therefore,

$\frac{c}{b}$

must be convergent of the continued fraction expansion of

$\frac{x}{N}.$

Hence, to recover a, b from x, N the convergent of the continued fraction expansion of are computed to find the convergent

$\frac{x}{N}$

with b greatest such that

$\frac{c}{b}$

and set a=bx−cN.

${b < \sqrt{\frac{N}{2}}},$

In an example, learning algorithms may be used to solve a variety of supervised learning tasks over encrypted data. For example, the data may be encrypted as described above. In an example, the goal of a supervised learning algorithm is to minimize expected risk, e.g., to minimize probability of an incorrect prediction for a random test point x∈R^(d) sampled from a fixed distribution D. That is,

$\min\limits_{w}{E_{{({x,y})} \sim D}\left\lbrack {l\left( {{f\left( {x;w} \right)},y} \right)} \right\rbrack}$

where x is a randomly sampled input data point, y is the expected output for x, and (x,y)˜D. ƒ (x; w) is the learning algorithm's predicted output for x, and ƒ is a parametric function with w being the parameter that is typically learned. l:R→R measures loss/risk for predicting ƒ(x; w) instead of y. The loss function typically decreases as ƒ(x; w) gets closer to y.

Unfortunately, in practice, direct access to D is not available. Instead, access to n training points (x_(i),y_(i)), 1≤i≤n which are assumed to be sampled i.i.d. from D are available. So, instead of minimizing the above given true risk, the empirical risk on training data is minimized. That is, the supervised learning problem can be re-cast into the following optimization problem:

$\min\limits_{w}{\sum\limits_{i}\; {{l\left( {{f\left( {x_{i};w} \right)},y} \right)}.}}$

Often, an L2 regularization term (∥w∥²) is also added to avoid overfitting of w to the training data. However, for ease of exposition, the unregularized objective function given above is considered and the disclosed algorithms may be extended to handle the L2 regularization as well.

A further restriction of the above problem may be considered where ƒ(x_(i); w) is a linear function e.g., ƒ(x_(i); w)=x_(i)·w and l is a smooth convex loss function. Then the loss function can be rewritten as,

$\min\limits_{w}{\sum\limits_{i}\; {{l\left( {{x_{i} \cdot w},y_{i}} \right)}.}}$

Even with these restrictions, this class of problems is still rich and covers a large fraction of important machine learning problems like least squares, logistic regression, etc. As mentioned above, the disclosed algorithms may be extended to handle L2-regularized problems as well. Algorithms for the high dimensional learning problems where L2 regularization is replaced by L1 regularization to promote sparsity in w are also described.

Using only the encrypted version of data (x_(i),y_(i)), 1≤i≤n the above problems may be solved as part of a machine learning process. The disclosed algorithms are designed to address the following two encryption related challenges: 1) ensuring that the amount of data processed on the client side is small, and 2) ensuring that the intermittent rounding-off of various model parameters, necessitated because of the multiple precision nature of the encryption scheme, does not affect the efficacy of the algorithm significantly.

As noted before, the encryption scheme evaluates k instances of an arithmetic circuit simultaneously. This fact is not shown in the notation while presenting the algorithms. A scalar u in the following algorithms is a vector of size k formed by k different numbers, one for each circuit. Similarly, a d dimensional vector w would be a k×d dimensional vector in various implementations. Also, as mentioned before, û is used to represent Enc_(A)(u) where A is the decryption key. These notations extend to all matrices as well.

The symbols +_(A),º_(A) used for denoting addition or product of encrypted numbers are dropped and instead overload the +,º symbols if the operators are clear from the context.

In an actual deployment scenario, the algorithms may consist of two sets of operations: those performed on the client side and those on the server side. Here, the operations are presented in the form of server routines with intermediate steps being carried out on the client. These intermediate steps are highlighted using a * instead of a line number in the algorithms.

The data (X,y)=([x₁, . . . , x_(n)]^(T), [y₁, . . . , y_(n)]) in all the algorithms is d dimensional with n points, i.e., X=[x₁, . . . , x_(n)]^(T)∈R^(n×d) and y∈R^(d). The learned linear model parameter is represented by w∈R^(d).

Linear Regression

The goal in a standard linear regression problem is to find a linear hyperplane w that best fits the given data points, e.g., the goal is to find y_(i)≈x_(i)·w. Typically, such a w is obtained by minimizing the squared error, e.g.,

${\min\limits_{w}{l(w)}} = {\sum\limits_{i = 1}^{n}\; {\left( {y_{i} - {x_{i} \cdot w}} \right)^{2}.}}$

An optimal solution to the above problem is given by: w*=(X^(T)X)⁻¹(X^(T)y). However, computing the inverse of X^(T)X may be very expensive and unstable; the time complexity of this method is O(d²n+d³). In an example, large datasets may be efficiently processed when the algorithm is linear in d and even sublinear in n. As described below, gradient descent (GD) and stochastic gradient descent (SGD) may be used over the encrypted data to achieve these results.

Gradient Descent.

The standard gradient descent method is an iterative method which moves the current iterate in the negative direction of a gradient to obtain the next iterate. The amount of movement of the current iterate is decided by a step-size or learn rate γ. That is, to optimize L(w): R^(d)→R, the following gradient descent update may be used:

W ^((t+1)) =W ^((t)) −γ∇L(w ^((t)))

where ∇L(w) is the gradient of L(w) and γ is the step size which can be kept to be a constant or decreased adaptively. Intuitively, such an update moves towards iterates with a smaller gradient, e.g., ∥∇L(w)∥ which implies that the gradient descent update moves towards a local minima or a saddle point. In the case of least squares problem, the objective function is convex and hence saddle points do not exist and all local minima are global minima. The update in this case is given by:

ŵ ^((t+1)) =ŵ ^((t)) −γ{circumflex over (X)} ^(T)({circumflex over (X)}ŵ ^((t)) −ŷ),

where γ is selected appropriately; typically,

$\gamma < \frac{1}{4\; L}$

where L is the largest eigenvalue of X^(T)X matrix. The multiplication and addition operators are the º_(A) and +_(A) operators described above that work over encrypted data.

The above formulate may be expanded to the following:

Enc_(A)(w ^((t+1)))=Enc_(A)(w ^((t)) −γX ^(T)(Xw ^((t)) −y)).

Each update, therefore, is multiplied by γ which is a number much smaller than 1 based upon that each entry in data matrix X is an integer. Hence, w_(j) ^((t+1)), ∀1≤j≤d will be given by a rational number whose numerator and denominator is increasing with t. After a small number of iterations, the numerator or denominator of w_(j) ^((t+1)) may be outside the allowed range of √{square root over (N/2)}.

If the numerator or denominator falls outside of the range, communication with the client may be used to round off w_(j) ^((t+1)) so that the value may be represented as a rational number with a numerator and denominator being small. In example, the server system may send the client system some or all of ŵ^((t+1)). The client system may then decrypt the data, rounds the data to include rational numbers with small numerators and denominators, encrypts the rounded data, and sends the encrypted data to the server system. The entire process may be completed via the following pseudocode, which the client system able to complete the steps indicated with a *:

  1: Input: Initial point ŵ⁽⁰⁾, {circumflex over (X)}, ŷ, step size γ, number of iterations per cycle l, convergence tolerance ϵ, precision p. 2: ρ ← true; t ← 1 3: while ρ do 4: ŵ^((t)) ← ŵ^((t−1)) − γ{circumflex over (X)}^(T)({circumflex over (X)}ŵ^((t−1)) − ŷ) // GD Update 5: if (i%l =)then *: w^((t)) ← Decrypt(ŵ^((t))) ${*\text{:}\mspace{14mu} \frac{\left. w^{(t)}\leftarrow\left\lfloor {w^{(t)}*2^{p}} \right\rfloor \right.}{2^{p}}}//{{precision}\mspace{14mu} {reduction}\mspace{14mu} {step}}$ *: ŵ^((t)) ← Encrypt(w^((t))) 6: end if 7: {circumflex over (ρ)} ← ||ŵ^((t)) − ŵ^((t−1))|| 8: t ← t + 1 9: end while 10: Return: ŵ^((t −1))

Given X, y, γ, and N, l may be precomputed, which is the number of iterations before any rouding-off operation may need to be completed. Using l, the amount of communication between the client system and the server system may also be estimated. In an example, l may be computed as:

$l \leq \frac{p}{{2\; b} + {\log \left( {4\; {nd}} \right)}}$

where p is the size of primes used in the encryption scheme and numbers are represented as integers using b bits. Thus, communication with the client system as well as the computational cost for the client system scales linearly with d and does not depend on the number of points n. This ensures the rounding operations and communication with the client system does not overwhelm the client system.

Stochastic Gradient Descent.

While working with big datasets, using standard gradient descent might be prohibitive as it works with the whole dataset at the same time. Instead of using all the points at the same time to make an update, the update may be made with one point at a time. This reduces the amount of computation required per update drastically. Also, empirically it has been observed that this approach, known as stochastic gradient descent, converges much faster than standard gradient descent.

For a stochastic gradient descent, the loss function may be l(w^((t)))=Σ_(j)l_(j)(w^((t))) where l_(j) is the loss function at a single point (x_(j),y_(j)). Then, for a uniformly random j picked from {1, . . . , n} the update for stochastic gradient descent is given as:

w ^((t+1)) =w ^((t)) −γl _(j)(w ^((t)))

In an example using least squares, l_(j)(w)=(w·x_(j)−y_(j))² and the form of the update for encrypted data is:

ŵ ^((t+1)) =ŵ ^((t)) −γ{circumflex over (x)} _(j)({circumflex over (x)} _(j) ·ŵ ^((t)) −ŷ _(i))

where step size γ is set appropriately; this value may be set to

$< {\frac{1}{4\; {\max_{j}{{x_{j}}_{2}^{2}}}}.}$

This step size may be used in gradient descent, which is a factor n smaller than the step size used in stochastic gradient descent. Thus, the rational representation of the step size in stochastic gradient descent is log₂ n bits smaller.

As noted above, the numerator and denominator of the rational representing w_(j) ^((t))∀1≤j≤d increases with every update. Noting that X and y may be made of integers then the increase in the denominator depends upon the size of the denominator of the step size only. A larger step size will have a smaller denominator and hence the denominator of w_(j) ^((t)) will grow comparatively slowly. Thus, more update steps may be performed on the server system before requesting rounding from the client system.

The value l may be precomputed to estimate the client-side communication and computation complexity. In an example, the parameter l may be calculated as

${l \leq \frac{p}{{2\; b} + {\log \left( {4\; d} \right)}}},$

where l is the maximum number of iterations performed on the server before requesting rounding by the client system. The communication and client-side computation complexity is given by

${O\left( \frac{\kappa \cdot d}{l \cdot \epsilon} \right)},$

where K is the condition number of X^(T)X. Comparing this to the complexity of gradient descent, a factor of log₂ n is saved in client-side communication and computation complexity while using stochastic gradient descent.

In an example, the algorithm for stochastic gradient descent is given by:

  1: Input: Initial point ŵ⁽⁰⁾, {circumflex over (X)}, ŷ, step size γ, number of iterations per cycle l, convergence tolerance ϵ, precision p. 2: ρ ← true; t ← 1 3: while ρ do 4: i ← R[1, ..., n] // pick a random index 4: ŵ^((t)) ←= ŵ^((t−1)) − γ{circumflex over (x)}_(i)({circumflex over (x)}_(i)ŵ^((t−1)) − ŷ_(i)) // SGD Update 5: if (i%l = 0)then *: w^((t)) ← Decrypt(ŵ^((t))) ${*\text{:}\mspace{14mu} \frac{\left. w^{(t)}\leftarrow\left\lfloor {w^{(t)}*2^{p}} \right\rfloor \right.}{2^{p}}}//{{precision}\mspace{14mu} {reduction}\mspace{14mu} {step}}$ *: ŵ^((t)) ← Encrypt(w^((t))) 6: end if 7: {circumflex over (ρ)} ← ||ŵ^((t)) − ŵ^((t−1))|| 8: t ← t + 1 9: end while 10: Return: ŵ^((t −1))

In an example, a gradient descent update may be applied to a general loss function l. For a typical loss function, such as logistic regression, the gradient function may need to handle more arithmetic operations than additions/multiplications. For example, in the case of logistic regression, the gradient function contains terms of the type:

$\frac{1}{1 + {\exp \left( {{yx} \cdot w} \right)}}$

which cannot be computed with just additions and multiplication operations.

The above gradient function may be approximated using a Taylor series expansion. However, even a quadratic approximation increases the communication significantly due to the numerators and denominators of w_(j) ^((t+1)) will increase exponentially which increases the amount of communication with the client system. In an example, a series of weighted least squares optimization problems may be used. Each of these problems may be solved using the stochastic gradient descent method described above. The reduction is based on using a Newton update leads to a significant decrease in the number of iterations as the number of iterations reduce to

${O\left( {\log \; \log \frac{1}{\epsilon}} \right)},$

where ϵ is the desired accuracy and the Newton update may be recast as a weighted least squares problem. These observations lead to an iteratively reweighted least squares (IRLS) algorithm where each “outer” step of the algorithm computes the Newton update using the weighted least squares formulation:

${w^{({t + 1})} = {\arg {\min\limits_{w}{\sum\limits_{i = 1}^{n}\; {\alpha_{i}\left( {{x_{i} \cdot w} - z_{i}} \right)}^{2}}}}},{{{where}\mspace{14mu} \alpha_{i}} = {{{l^{''}\left( {{x_{i} \cdot w^{(t)}};y_{i}} \right)}\mspace{14mu} {and}\mspace{14mu} z_{i}} = {{x_{i} \cdot w^{(t)}} - {\frac{l^{\prime}\left( {{x_{i} \cdot w^{(t)}};y_{i}} \right)}{l^{''}\left( {{x_{i} \cdot w^{(t)}};y_{i}} \right)}.}}}}$

Note the number of outer steps may be small. Using this weighted least squares formulation, the server system may communicate x_(i)·w^((t)), ∀i with the client system. The weights and other parameters may then be evaluated by the client side. Each round of client communication, therefore, may cost O(n). The update for the outer step, e.g., the weighted least squares problem may be solved on the server side by using a series of stochastic gradient descent in the “inner” steps. The stochastic gradient descent steps work directly with the encrypted data and the number of iterations before the client system may do rounding is given by l as described above. Below is an example IRLS gradient descent algorithm.

  1: input: Initial point ŵ⁽⁰⁾, {circumflex over (X)}, ŷ, step size γ, number of iterations per cycle l, number of points n, convergence tolerance ϵ, precision p. 2: ρ ← true; t ← 1 3: while ρ do 4: // outer loop 5: Sample b tuples {{circumflex over (x)}_(i), ŷ_(i)}_(i=1) ^(b) from the set of all tuples and stack them to form the matrix {circumflex over (X)}^((t)) and vector ŷ^(t) *: Compute {circumflex over (n)} = {circumflex over (X)}^((t))ŵ^((t)) *: Computer n = Decrypt({circumflex over (n)}), ${{*\text{:}\mspace{14mu} {Compute}\mspace{14mu} {weights}\mspace{14mu} \beta_{i}} = {\sqrt{\alpha_{i}} = \sqrt{l^{''}\left( {{x_{i} \cdot w^{t}};y_{i}} \right)}}},{v_{i} = {{\beta_{i}z_{i}} = {{{\beta_{i}\left( {{x_{i} \cdot w^{(t)}} - \frac{l^{\prime}\left( {{x_{i} \cdot w^{t}};y_{i}} \right)}{l^{''}\left( {{x_{i} \cdot w^{t}};y_{i}} \right)}} \right)}\mspace{11mu} {for}\mspace{14mu} {all}\mspace{14mu} \left( {x_{i},y_{i}} \right)} \in \left( {X^{(t)},y^{(t)}} \right)}}}$ *: {circumflex over (β)}_(i) ← Encrypt(β_(i)), {circumflex over (v)}_(i) ← Encrypt(v_(i)) ∀1 ≤ i ≤ b 7: ŵ^((t)) ←SGD-LS (ŵ^((t−1)), diag(β){circumflex over (X)}^((t)), {circumflex over (v)}, γ, l, n, ϵ, p) 8: {circumflex over (ρ)} ← ||ŵ^((t)) − ŵ^((t−1))||₂ *: ρ ← Decrypt({circumflex over (ρ)} ) *: ρ ← ρ >ϵ 9: t ← t + 1 10: end while 11: Return: ŵ^((t−1))

In an example, the general technique described above may be applied to a logistic regression problem. Logistic regression is a popular method for classification problems and is a special case of l(x_(i)·w, y_(i)) given by:

l(x _(i) ·w,y _(i))=−y _(i) log(a _(i))−(1−y _(i))log(1−a _(i)),

where

$a_{i} = {\frac{1}{1 + {\exp \left( {{- x_{i}} \cdot w} \right)}}.}$

The gradient descent or the stochastic gradient descent may be applied directly to the above loss function. The algorithm for this application is provided below. As the Hessian of the objective function changes with w, the step size also needs to be selected in each iteration. In an example, the standard Armijo rule for step-size determination may be used. In an example, to reduce the amount of communication between the client and server systems, a second order Taylor series approximation of the loss function may be used. The notation l_(t) is used to represent the degree-2 Taylor series approximation of the log-loss function l for logistic regression. The second order Taylor series approximation may be given by:

${l_{t}(w)} = {\sum\limits_{j = 1}^{n}\; \left( {{\log \; 2} - \frac{\theta_{j}}{2} + \frac{\theta_{j}^{2}}{4}} \right)}$

where θ_(j)=y_(i)(x_(j)·w). Armijo rule starts with a large enough step size and checks if the gradient descent step leads to a decrease in the loss function that may be approximated by its 2^(nd) order Taylor series. If there is a decrease, that step size is selected otherwise, the step size is decreased and the loss function is checked again.

  1: input: Initial point ŵ⁽⁰⁾, {circumflex over (X)}, ŷ, step size y, precision p. 2: γ ← 1, K ← 10⁻⁴, δ ← 0.5 3: ρ ← true; t ← 1 4: while ρ do 5: {circumflex over (θ)} ← ŷ°({circumflex over (X)}ŵ^((t−1))) $\left. {*\text{:}\mspace{14mu} \theta}\leftarrow{{Decrypt}\left( \hat{\theta} \right)} \right.,\left. \vartheta_{i}\leftarrow\frac{\left\lfloor \frac{2^{p}}{1 + e^{\theta_{i}}} \right\rfloor}{2^{p}} \right.,{1 \leq i \leq n}$ *: {circumflex over (ϑ)} ← Encrypt(ϑ) //Compute derivate of the log-loss at each point 6: {circumflex over (∇)} ← Σ_(i=1) ^(n) ŷ_(i), {circumflex over (ϑ)}_(i){circumflex over (x)}_(i) 7: // step-size computation using Armijo rule 8: while true do 9: ŵ^((t)) ← ŵ^((t−1)) − γ{circumflex over (∇)} 10: {circumflex over (r)}^((t)) ← l_(t)(ŵ^((t))) − l_(t)(ŵ^((t−1))) + kγ||{circumflex over (∇)}||₂ ² *: r ← Decrypt({circumflex over (r)}) 11: if r < 0 then 12: break // the objective function value decreases 13: end if 14: γ ← δγ 15: end while 16: {circumflex over (ρ)} ← ||ŵ^((t)) − ŵ^((t−1))||₂ *: ρ ← Decrypt({circumflex over (ρ)} ), ρ ← ρ >ϵ 17: t ← t + 1 18: end while 19: Return: ŵ^((t−1))

In an example, some applications may need to learn from high-dimensional data points where the dimensionality of a feature vector d may far exceed the number of available data points n. Text processing and bio-informatics are two example domains where this may be the case. Finding a sparse w which implies the prediction function that would depend on only a small number of features is one way to approach these domains.

For example, two approaches to a sparse domain include using L1 regularization to promote sparsity in w or using an explicit constraint on the number of non-zeros in w. Both approaches may be implemented using the encrypted data as described above.

The L1 regularization approach may optimize the following problem:

J(w)=∥Xw−y| ₂ ² +λ∥w∥

where λ>0 is the regularization parameter and ∥w|₁=Σ_(j)|w_(j)|. As L1 norm is not a differentiable function, gradient descent and stochastic gradient descent may not be used directly. Rather, an iteratively reweighted scheme may be used to minimize the above loss function.

Like the IRLS algorithm from above, the L1 regularized problem may be reduced to a series of weighted L2 regularized least squares problem. That is, in the “outer” loop the following optimization problem may be solved:

J ^((t))(w)=Σ_(i)(x _(i) ·w−y _(i))²+λΣ_(j)β_(j) ^((t)) w _(j) ²,

where α_(j) ^((t)) is the weight corresponding to the jth feature. In the t-the iteration,

$\alpha_{j}^{(t)} = {\frac{1}{w_{j}^{({t - 1})}}.}$

Each “outer” iteration solves for the above weighted least squares problem over encrypted data for which a variant of the gradient descent method may be used. The pseudo code for such an algorithm is:

1: Input: Initial point ŵ⁽⁰⁾, {circumflex over (X)}, ŷ, step size γ, regularization parameter λ, number of iterations per cycle l, convergence tolerance ϵ, precision p. 2: ρ ← true; t ← 1 3: while ρ do $\left. {*\text{:}\mspace{14mu} {\hat{\alpha}}_{j}}\leftarrow{{Encrypt}\left( \frac{1}{w_{j}^{(t)}} \right)} \right.//{{computing}\mspace{14mu} {the}\mspace{14mu} {weights}}$ 4: û⁽¹⁾ ← ŵ^((t−1)), ρ′ ← true, τ ← 1 5: while ρ′ do 6: û^((τ+1)) ← û^((τ)) − γ{circumflex over (X)}^(T)({circumflex over (X)}^(T)({circumflex over (X)}û^((τ)) − ŷ) + λ(diag(α)û^((τ)))) // GD Update 7: if τ%l = 0 then *: u^((τ+1)) ← Decrypt(û^((τ+1))) *: u^((τ+1)) ← └u^((τ+1)) * 2^(p)┘/2^(p) * û^((τ+1)) ← Encrypt(u^((τ+1))) 8: end if 9: {circumflex over (ρ)}′ ← ||û^((τ+1)) − û^((τ))||₂ *: ρ′ ← Decrypt({circumflex over (ρ)}′ ),ρ′ ← ρ′ >ϵ 10: τ ← τ + 1 11: end while 12: ŵ^((t)) ← û^(τ) 13: {circumflex over (ρ)} ← ||ŵ^((t)) − ŵ^((t−1))||₂ *: ρ ← Decrypt({circumflex over (ρ)} ), ρ ← ρ >ϵ 14: t ← t + 1 15: end while 16: Return: ŵ^((t−1))

In an example, another approach for a high-dimensional learning problem is considered that is a hard non-convex sparsity constraint in the optimization problem. For this approach, hard thresholding of the encrypted data may be used. A step of gradient descent may be performed, some of the top weighted features are chosen, and then a solution is searched for based on these limited features. This procedure is iteratively performed while feeding the result of the end of an iterate to the starting of the next.

In this example, communication with the client is only needed to determine the top weighted features. Those features do not need to be re-encrypted from the client. For a matrix X, P_(S)(X) to denote the matrix obtained when looking at the columns in set S. The hard thresholding operation may be defined HT_(k)(w^((t))) which returns the indices of the top k absolute values in vector w^((t)). The computation and communication cost for the client system for this example is linear in dimensionality d of the feature vectors x_(i). The pseudo code for this approach follows:

 1: Input: Initial point ŵ⁽⁰⁾, {circumflex over (X)}, ŷ, step size γ, sparsity level k, number of iterations per cycle l, convergence tolerance ϵ, precision p.  2: ρ ← true; t ← 1  3: while ρ do  4: ŵ^((t)) ← ŵ^((t−1)) − γ{circumflex over (X)}^(T)({circumflex over (X)}ŵ^((t−1)) − ŷ) // GD Update  *: w^((t)) ← Decrypt(ŵ^((t)))  *: S ← HT_(k)(w^((t))) // top k features of ŵ^((t))  5: {circumflex over (ν)}⁽⁰⁾ ← P_(S)(ŵ^((t)))  6: {circumflex over (ρ)}′ ← true, τ ← 1  7: while ρ′ do  8: {circumflex over (ν)}^(τ) ← {circumflex over (ν)}^(τ) − γP_(S)({circumflex over (X)})^(T) (P_(S)({circumflex over (X)}){circumflex over (ν)}^((τ−1)) − ŷ) // GD update  9: if i%l = 0 then  * ν^(τ) ← Decrypt({circumflex over (ν)}^(τ))  * ν^(τ) ← └ν^(τ) * 2^(p)┘/2^(p)  * {circumflex over (ν)}^(τ) ← Encrypt(ν^(τ)) 10: end if 11: {circumflex over (ρ)}′ ← ∥{circumflex over (ν)}^((τ)) − {circumflex over (ν)}^((τ−1))∥₂, τ ← τ + 1  *: ρ′ ← Decrypt({circumflex over (ρ)}′ ),ρ′ ← ρ′ >∈ 12: end while 13: P_(S)(ŵ^((t))) ← {circumflex over (ν)}^((τ−1)), P _(S) (ŵ^((t))) ← 0 // updating top k dimensions and setting others to 0 14: {circumflex over (ρ)} ← ∥ŵ^((t)) − ŵ^((t−1))∥₂  *: ρ ← Decrypt({circumflex over (ρ)} ), ρ ← ρ >∈ 15: t ← t + 1 16: end while 17: Return: ŵ^((t−1))

FIG. 3 is a flow diagram of processing encrypted data at a server system in accordance with respective examples. In this example, a server system 304 is able to run machine learning algorithms on encrypted data received from a client system 302. The server system 304 trains models using only the encrypted data and never needs to decrypt the client's data. To protect its data, at 310, the client system 302 may create various keys. In an example, an encryption key, a decryption key, and a computation key are created by the client system 302. At 312, the client system 302 encrypts its data using the encryption key. The encrypted data may be a data set used to train a model. The data set may be split into training and validation examples. At 314, the encrypted data is sent to the server system 304. At 316, the server system may train a model using the encrypted data or a subset of the encrypted data using any of the various models described above. At 318 after a determined number of training iterations have occurred, the server system 304 provides the client system 302 with an intermediate model. The intermediate model is encrypted with the encryption key. At 320, the client system 302 may decrypt the model. At 322, the client system 322 may round one or more weights within the intermediate model. At 324, the updated model is encrypted with the encryption key. At 326, the encrypted updated model is sent to the server system 304 for further processing. At 328, the server system 304 continues to train the model based upon the received encrypted data. The updated model has weights that are able to be expressed and processed in the described encryption scheme. Eventually, a specified number of iterations or a precision of the model is reached. At this point, the model is considered the final model. At 330, the encrypted final model may be sent back to the client system 302. The client system 302 may decrypt the final model and use the model to process data. In an example, the client system 302 may provide the server system 304 with additional encrypted data. The server system 304 may input this additional data into the model and provide the client system 302 with the results. In this example, the additional data, the model, and the results are always encrypted at the server system 304.

FIG. 4 is an example computing device that can be used in conjunction with the technologies described herein. In alternative embodiments, the computing device 400 may operate as a standalone device or may be connected (e.g., networked) to other computing devices. In a networked deployment, the computing device 400 may operate in the capacity of a server communication device, a client communication device, or both in server-client network environments. In an example, the computing device 400 may act as a peer computing device in peer-to-peer (P2P) (or other distributed) network environment. The computing device 400 may be a personal computer (PC), a tablet PC, a set top box (STB), a personal digital assistant (PDA), a mobile telephone, a smart phone, a web appliance, a network router, switch or bridge, or any computing device capable of executing instructions (sequential or otherwise) that specify actions to be taken by that computing device. Further, while only a single computing device is illustrated, the term “computing device” shall also be taken to include any collection of computing devices that individually or jointly execute a set (or multiple sets) of instructions to perform any one or more of the methodologies discussed herein, such as cloud computing, software as a service (SaaS), other computer cluster configurations.

Computing device 400 may include a hardware processor 402 (e.g., a central processing unit (CPU), a graphics processing unit (GPU), a hardware processor core, or any combination thereof), a main memory 404 and a static memory 406, some or all of which may communicate with each other via an interlink (e.g., bus) 408. The computing device 400 may further include a display unit 410, an input device 412 (e.g., a keyboard), and a user interface (UI) navigation device 414 (e.g., a mouse). In an example, the display unit 410, input device 412, and UI navigation device 414 may be a touch screen display. In an example, the input device 412 may include a touchscreen, a microphone, a camera (e.g., a panoramic or high-resolution camera), physical keyboard, trackball, or other input devices.

The computing device 400 may additionally include a storage device (e.g., drive unit) 416, a signal generation device 418 (e.g., a speaker, a projection device, or any other type of information output device), a network interface device 420, and one or more sensors 421, such as a global positioning system (GPS) sensor, compass, accelerometer, motion detector, or another sensor. The computing device 400 may include an input/output controller 428, such as a serial (e.g., universal serial bus (USB), parallel, or other wired or wireless (e.g., infrared (IR), near field communication (NFC), etc.) connection to communicate or control one or more peripheral devices (e.g., a printer, card reader, etc.) via one or more input/output ports.

The storage device 416 may include a computing-readable (or machine-readable) storage media 422, on which is stored one or more sets of data structures or instructions 424 (e.g., software) embodying or utilized by any one or more of the techniques or functions described herein. In an example, at least a portion of the software may include an operating system and/or one or more applications (or apps) implementing one or more of the functionalities described herein. The instructions 424 may also reside, completely or at least partially, within the main memory 404, within the static memory 406, and/or within the hardware processor 402 during execution thereof by the computing device 400. In an example, one or any combination of the hardware processor 402, the main memory 404, the static memory 406, or the storage device 416 may constitute computing device (or machine) readable media.

While the computer-readable storage media 422 is illustrated as a single medium, a “computer-readable storage media” or “machine-readable storage media” may include a single medium or multiple media (e.g., a centralized or distributed database, and/or associated caches and servers) configured to store the one or more instructions 424.

In an example, a computer-readable storage media or machine-readable storage media may include any medium that is capable of storing, encoding, or carrying instructions for execution by the computing device 400 and that cause the computing device 400 to perform any one or more of the techniques of the present disclosure, or that is capable of storing, encoding or carrying data structures used by or associated with such instructions. Non-limiting computer-readable storage media examples may include solid-state memories, and optical and magnetic media. Specific examples of computer-readable storage media may include: non-volatile memory, such as semiconductor memory devices (e.g., Electrically Programmable Read-Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM)) and flash memory devices; magnetic disks, such as internal hard disks and removable disks; magneto-optical disks; Random Access Memory (RAM); and optical media disks. The computer-readable storage media is non-transitory in that the storage media does not consist of transitory propagating signals.

The instructions 424 may further be transmitted or received over a communications network 426 using a transmission medium via the network interface device 420 utilizing any one of several transfer protocols (e.g., frame relay, internet protocol (IP), transmission control protocol (TCP), user datagram protocol (UDP), hypertext transfer protocol (HTTP), etc.). Example communication networks may include a local area network (LAN), a wide area network (WAN), a packet data network (e.g., the Internet), mobile telephone networks (e.g., cellular networks), Plain Old Telephone (POTS) networks, and wireless data networks (e.g., Institute of Electrical and Electronics Engineers (IEEE) 802.8 family of standards known as Wi-Fi®, IEEE 802.16 family of standards known as WiMax®), IEEE 802.15.4 family of standards, a Long Term Evolution (LTE) family of standards, a Universal Mobile Telecommunications System (UMTS) family of standards, peer-to-peer (P2P) networks, among others. The network interface device 420 may use the transfer protocols to transmit data using transitory propagating signals.

In an example, the network interface device 420 may include one or more physical jacks (e.g., Ethernet, coaxial, or phone jacks) or one or more antennas to connect to the communications network 426. In an example, the network interface device 420 may include one or more wireless modems, such as a Bluetooth modem, a Wi-Fi modem or one or more modems or transceivers operating under any of the communication standards mentioned herein. In an example, the network interface device 420 may include a plurality of antennas to wirelessly communicate using at least one of single-input multiple-output (SIMO), multiple-input multiple-output (MIMO), or multiple-input single-output (MISO) techniques. In some examples, the network interface device 420 may wirelessly communicate using Multiple User MIMO techniques. In an example, a transmission medium may include any intangible medium that is capable of storing, encoding or carrying instructions for execution by the computing device 400, and includes digital or analog communications signals or like communication media to facilitate communication of such software.

Any of the computer-executable instructions for implementing the disclosed techniques as well as any data created and used during implementation of the disclosed embodiments can be stored on one or more computer-readable storage media. The computer-executable instructions can be part of, for example, a dedicated software application or a software application that is accessed or downloaded via a web browser or other software application (such as a remote computing application). Such software can be executed, for example, on a single local computer (e.g., any suitable commercially available computer) or in a network environment (e.g., via the Internet, a wide-area network, a local-area network, a client-server network (such as a cloud computing network), or other such network) using one or more network computers.

The above description is intended to be illustrative, and not restrictive. For example, the above-described examples (or one or more aspects thereof) may be used in combination with others. Other embodiments may be used, such as by one of ordinary skill in the art upon reviewing the above description. Further, the following claims are hereby incorporated into the Detailed Description, with a claim standing on its own as a separate embodiment. The scope of the embodiments disclosed herein is to be determined with reference to the appended claims, along with the full scope of equivalents to which such claims are entitled. 

1. A method for secure data analysis results based upon encrypted data, the method comprising: creating an encryption key; creating a decryption key, security of encryption using the encryption key and the decryption key based upon factoring, and the encryption key and the decryption key are private; creating a computation key based upon the encryption key; encrypting, using the encryption key, data to create the encrypted data; providing the encrypted data and the computation key to a remote system; requesting the remote system perform data analysis on the encrypted data, the remote system uses the computation key to perform the data analysis on the encrypted data; receiving, from the remote system, an encrypted result of the data analysis, the encrypted result of the data analysis encrypted with the encryption key; and decrypting the encrypted result of the data analysis with the decryption key.
 2. The method of claim 1, the decryption key is a matrix.
 3. The method of claim 2, the computation key based upon the matrix.
 4. The method of claim 2, the encryption key is a right inversion of the decryption key.
 5. The method of claim 1, the data analysis comprises training a model, and the encrypted result of the data analysis comprises a final trained machine learning model.
 6. The method of claim 5, the final trained machine learning model comprises a result of an operation performed on the encrypted vector of numbers.
 7. The method of claim 5, the operation is multiplication, and the operation uses the computation key.
 8. The method of claim 6, the multiplication uses a reducer based on a modulo operation.
 9. The method of claim 5, further comprising: receiving from the remote system an encrypted intermediate trained machine learning model; decrypting the encrypted intermediate trained machine learning model, the intermediate trained machine learning model comprising a weight represented by a numerator and a denominator; rounding the weight to reduce the number of digits in the numerator and the denominator to create an updated trained machine learning model; encrypting the updated trained machine learning model with the encryption key; and providing the updated trained machine learning model to the remote system, the final trained machine learning based on the updated trained machine learning model.
 10. A system for secure data analysis based upon encrypted data, the system comprising: a processing unit configured to perform operations comprising: creating an encryption key; creating a decryption key, security of encryption using the encryption key and the decryption key based upon factoring, and the encryption key and the decryption key are private; creating a computation key based upon the encryption key; encrypting, using the encryption key, data to create the encrypted data; providing the encrypted data and the computation key to a remote system; requesting the remote system perform data analysis on the encrypted data, the remote system uses the computation key to perform the data analysis on the encrypted data; receiving, from the remote system, an encrypted result of the data analysis, the encrypted result of the data analysis encrypted with the encryption key; and decrypting the encrypted result of the data analysis with the decryption key.
 11. The system of claim 10, the decryption key is a matrix.
 12. The system of claim 11, the computation key based upon the matrix.
 13. The system of claim 11, the encryption key is a right inversion of the decryption key.
 14. The system of claim 10, the data analysis comprises training a model, the encrypted result of the data analysis comprises a final trained machine learning model, the final trained machine learning model comprises a result of an operation performed on the encrypted vector of numbers.
 15. The system of claim 14, the operation is multiplication, and the operation uses the computation key.
 16. The system of claim 15, the multiplication uses a reducer based on a modulo operation.
 17. A non-transitory computer-readable storage media storing computer-executable instructions for secure data analysis based upon encrypted data, the stored instructions comprising: instructions to create an encryption key; instructions to create a decryption key, security of encryption using the encryption key and the decryption key based upon factoring, and the encryption key and the decryption key are private; instructions to create a computation key based upon the encryption key; instructions to encrypt, using the encryption key, data to create the encrypted data; instructions to provide the encrypted data and the computation key to a remote system; instructions to request the remote system perform data analysis on the encrypted data, the remote system uses the computation key to perform the data analysis on the encrypted data; instructions to receive, from the remote system, an encrypted result of the data analysis, the encrypted result of the data analysis encrypted with the encryption key; and decrypting the encrypted result of the data analysis with the decryption key.
 18. The non-transitory computer-readable storage media of claim 17, the decryption key is a matrix.
 19. The non-transitory computer-readable storage media of claim 18, the computation key based upon the matrix.
 20. The non-transitory computer-readable storage media of claim 18, the encryption key is a right inversion of the decryption key. 